﻿@model ProjectHopur23.Models.PrepareGameViewModel

<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/Content/bootstrap.css" />
<link rel="stylesheet" type="text/javascript" href="/Scripts/bootstrap.js" />
<link rel="stylesheet" type="text/javascript" href="/Scripts/jquery-1.8.2.js" />



@using (Html.BeginForm())
{
	@Html.ValidationSummary(true)
	<fieldset>
		<legend>Model.theGame.name</legend>

	@Html.HiddenFor(Model => Model.theActiveGame.ID)
	@Html.HiddenFor(Model => Model.theGame.ID)
	@Html.HiddenFor(Model => Model.theGame.engName)
	@Html.HiddenFor(Model => Model.theGame.minPlayers)
	@Html.HiddenFor(Model => Model.theGame.maxPlayers)
	@Html.HiddenFor(Model => Model.duplicatePlayers)

	<div class="Editor">
		<label>Gælunafn leiks</label>
		@Html.EditorFor(Model => Model.theActiveGame.name)
		@Html.ValidationMessageFor(Model => Model.theActiveGame.name)
	</div>

    <label>Fjöldi spilara</label>
	<select name="theActiveGame.numberOfPlayers">
	@for(int i = Model.theGame.minPlayers; i <= Model.theGame.maxPlayers; i++)
	{
		<option value="@i">@i</option>
	}
	</select>
	<br />

    <label>Hver má taka þátt?</label>
	<select name="theActiveGame.isOpen">
		<option value="false">Sá sem fær boð</option>
		<option value="true">Hver sem er</option>
	</select>
	<br />

	@Html.ValidationMessageFor(Model => Model.duplicatePlayers)

	@for(int pl = 2; pl <= Model.theGame.maxPlayers; pl++)
	{
		<div class="Editor">
			<label>Leikmaður @pl</label>
			@Html.EditorFor(x => Model.thePlayers[pl-2])
			@Html.ValidationMessageFor(x => Model.thePlayers[pl-2])
		</div>
	}

	<input type="submit" value="Hefja leik">
	<input type="button" value="Til baka" onclick="history.back(-1)" />

	</fieldset>
}
